package com.ruoyi.system.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.StbCompany;
import com.ruoyi.system.mapper.StbCompanyMapper;
import com.ruoyi.system.service.IStbCompanyService;

/**
 * 企业Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-02-08
 */
@Service
public class StbCompanyServiceImpl implements IStbCompanyService 
{
    @Autowired
    private StbCompanyMapper stbCompanyMapper;

    /**
     * 查询企业
     * 
     * @param compId 企业ID
     * @return 企业
     */
    @Override
    public StbCompany selectStbCompanyById(Long compId)
    {
        return stbCompanyMapper.selectStbCompanyById(compId);
    }

    /**
     * 查询企业列表
     * 
     * @param stbCompany 企业
     * @return 企业
     */
    @Override
    public List<StbCompany> selectStbCompanyList(StbCompany stbCompany)
    {
        return stbCompanyMapper.selectStbCompanyList(stbCompany);
    }

    /**
     * 新增企业
     * 
     * @param stbCompany 企业
     * @return 结果
     */
    @Override
    public int insertStbCompany(StbCompany stbCompany)
    {
        stbCompany.setCreateTime(DateUtils.getNowDate());
        return stbCompanyMapper.insertStbCompany(stbCompany);
    }

    /**
     * 修改企业
     * 
     * @param stbCompany 企业
     * @return 结果
     */
    @Override
    public int updateStbCompany(StbCompany stbCompany)
    {
        stbCompany.setUpdateTime(DateUtils.getNowDate());
        return stbCompanyMapper.updateStbCompany(stbCompany);
    }

    /**
     * 删除企业对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteStbCompanyByIds(String ids)
    {
        return stbCompanyMapper.deleteStbCompanyByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除企业信息
     * 
     * @param compId 企业ID
     * @return 结果
     */
    @Override
    public int deleteStbCompanyById(Long compId)
    {
        return stbCompanyMapper.deleteStbCompanyById(compId);
    }
    
    /*
	 * 查询各类企业数量
	 */
    @Override
    public List<Map<String,Object>> selectCompTypeCount(StbCompany stbCompany)
    {
        return stbCompanyMapper.selectCompTypeCount(stbCompany);
    }

	@Override
	public List<Map<String, Object>> selectNewCompany(StbCompany stbCompany) {
		return stbCompanyMapper.selectNewCompany(stbCompany);
	}

	@Override
	public List<Map<String, Object>> selectStarCompany(StbCompany stbCompany) {
		return stbCompanyMapper.selectStarCompany(stbCompany);
	}
}
